home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5682 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.8 KB  |  49 lines

  1. Newsgroups: comp.lang.c
  2. Path: news.eunet.fi!nullnet!ichaos!jlaiho
  3. From: jlaiho@ichaos.nullnet.fi (Juha Laiho)
  4. Subject: Re: Function pointers; example code 
  5. Content-Type: text/plain; charset=ISO-8859-1
  6. Content-Transfer-Encoding: 8bit
  7. Organization: NullNet r.y. 
  8. Message-ID: <Dn32E0.A62@ichaos.nullnet.fi>
  9. References: <DMwzBL.HDt@ichaos.nullnet.fi> <TANMOY.96Feb18112049@qcd.lanl.gov>
  10. Mime-Version: 1.0
  11. Date: Tue, 20 Feb 1996 16:41:59 GMT
  12.  
  13. tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) said:
  14. >In article <DMwzBL.HDt@ichaos.nullnet.fi> jlaiho@ichaos.nullnet.fi
  15. >(Juha Laiho) writes: 
  16. ><snip>
  17. >   Here's a short program I wrote as an example of function pointers. I'd
  18. >   appreciate _any_ comments about it.
  19. >
  20. ...
  21. >   typedef void f(int); /* f is a type that is a function taking one int
  22. >             * argument and returning an int
  23. >             */
  24. >Pointless and incorrect comment!
  25.  
  26. Incorrect - yes I had forgotten to change the comment while I changed the
  27. code. Pointless - IMHO no. I wrote this code as an example to use when
  28. someone asks me about function pointers and how to use them. I like to be
  29. able to just send compilable code with all the necessary explanations in the
  30. comments.
  31.  
  32. >   typedef f *ptf;      /* ptf is a type that is a pointer to a function */
  33. >
  34. >ptf is a pointer to a specific kind of function.
  35.  
  36. Yes, I should change this, it seems.
  37.  
  38. >   f a, b, c; /* Define three functions a, b and c; each is 'void f(int)' */
  39.                   ^^^^^^
  40. Also, someone sent me email telling that "declare" would be the correct term
  41. here.
  42.  
  43. Thank You all for the answers!
  44. -- 
  45. Wolf  a.k.a.  Juha Laiho     Espoo, Finland
  46. (GEEK CODE 3.0) GIT d- s+: a- C++ UH++++$ UL++++ P- L+++ E--- W+ N+++ !K w !O
  47.             !M V PS(+) PE Y+ !PGP t- 5? X? R tv- b+ DI? D+ G e+ h!>--- r++ y+
  48. "...cancel my subscription to the resurrection!" (Jim Morrison)
  49.